<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- import CSS -->
    <link rel="stylesheet" href="element-ui/lib/theme-chalk/index.css">
</head>

<body>
    <div id="app">
        <el-button>添加</el-button>
        <i class="el-icon-delete"></i>
        <el-button type="primary" icon="el-icon-search">搜索</el-button>
        <el-table :data="teacherList" stripe border style="width: 100%">

            <el-table-column type="selection" width="55"></el-table-column>

            <el-table-column prop="name" label="姓名"></el-table-column>

            <el-table-column prop="gmtCreate" label="入驻日期"></el-table-column>

            <el-table-column label="级别">
                <template slot-scope="scope">
                    <el-tag :type="scope.row.level === 1 ? 'primary' : 'success'" disable-transitions>
                        {{scope.row.level===1?'首席讲师':'高级讲师'}}</el-tag>
                </template>
            </el-table-column>
        </el-table>
    </div>
    <script src="./vue.min.js"></script>
    <script src="./axios.min.js"></script>
    <script src="./element-ui/lib/index.js"></script>
    <script>
        new Vue({
            el: '#app',
            data: {
                teacherList: []
            },
            created() {
                this.getTeachers();
            },
            methods: {
                getTeachers() {
                    axios.get('/edu/teacher/list', {
                        //配置信息  baseURL , method , params , timeout , url
                        baseURL: 'http://localhost:8110',
                        timeout: 5000
                    }).then(response => {
                        this.teacherList = response.data.data.items
                        console.log(response.data.data.items)
                    }).catch(error => {
                        console.log(error)
                    })
                }
            }
        })
    </script>
</body>

</html>